from pprint import pprint

import pandas as pd

# data = pd.read_csv("../data/lj_data.csv", sep=',')
# # print(data.loc[0])
# # print(data.loc[0, '地址'])
# #
# # print(data.loc[[1,3,2,6], ['地址', '户型', '标题']].values)
# # # print(data.iloc[3, 8])
# # # print(data.iloc[[3, 4, 5], [5, 6, 7]])
# # # 将pd读取出来的数据转换为列表列表 [[],[],[]]
# # # pprint(data.iloc[[0,1,2,3]].values.tolist())
# # list1 = []
# # print(data.index.values)
# # for i in data.index.values:
# #     list1.append(data.loc[i].to_dict())
# #
# # # lict1 = [data.loc[i].to_dict() for i in data.index.values]
# # # print(lict1)
import pandas as pd
from  pprint import  pprint
#读取数据
data = pd.read_csv('../data/lj_data.csv', sep=',')
# print(data)
# #c查看前几行 head
# print(data.head())
# print(data)
# #查看数据的行和列
# print(data.shape)
# #查看字段名 cilumns
# print(data.columns)
# #查看索引 index
# print(data.index)

#loc
# print(data.loc[1,'区域'])
# print(data.loc[[1,2,3],['区域','户型','面积']])
# print(data.iloc[1])
# print(data.iloc[[1,2,3],[1,2,3]])
print(data.iloc[1].to_dict())
print(data.iloc[1].values.tolist())
print(data.index.values)
list1 = []
for i in data.index.values:
   print(data.iloc[i].to_dict())
print(len(list1))
pprint(list1)
list2 = [data.loc[i].to_dict() for i in data.index.values]
print(list2)



